﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Salary
{
    class Worker : Employee
    {
        public double yearlySalary { get; private set; }
        public Worker(string name, double yearlySalary) : base(name)
        {
            if (yearlySalary <= 0)
            {
                throw new Exception("Salary should be grated than 0");
            }
            else
            {
                this.yearlySalary = yearlySalary;
            }
        }

        public override void CalculateSalary()
        {
            Console.WriteLine("Name: {0}, Salary: {1:0.##}$", name, yearlySalary/12);
        }
    }
}
